package main;

public class CommitThread extends Thread {

	boolean waiting ; 
	FileHandler fileHandler ; 
	private static CommitThread instance ; 
	private CommitThread(FileHandler fileHandler)
	{
		super("Commit Thread");
		this.fileHandler = fileHandler ;

	}

	public static CommitThread getInstance(FileHandler fileHandler)
	{
		if(instance==null)
		{
			instance = new CommitThread(fileHandler);
		}

		return instance ;
	}

	public boolean getWaiting()
	{
		return waiting; 
	}

	public void setWaiting(boolean value)
	{
		waiting = value ; 
	}


	public void run()
	{

		while(true)
		{
			if(!waiting)
			{
				fileHandler.commit() ; 
			}
		}		
	}
}




